<template>
    <div>
      测试01
      <button @click="demo01">编程式导航(replace函数-url地址跳转)</button>
      <button @click="demo02">编程式导航(replace函数-name值跳转)</button>
      <button @click="demo03">编程式导航(push函数-url地址跳转)</button>
      <button @click="demo04">编程式导航(push函数-name值跳转)</button>


    </div>
</template>

<script>
    export default {
        name: "Test01",
        methods:{
           demo01(){//编程式导航(replace函数-url地址跳转)
             this.$router.replace("/test02");
             localStorage.setItem("name","张三") ;
          },
          demo02(){//编程式导航(replace函数-name值跳转)
            this.$router.replace({"name":"Test02",query:{"name":"李四"}});

          },
          demo03(){//编程式导航(push函数-url地址跳转)
            this.$router.push("/test02");
          },
          demo04(){//编程式导航(push函数-name值跳转)
            this.$router.push({"name":"Test02"});
          }
        }
    }
</script>

<style scoped>

</style>
